title: ImageIO: makerApple description: readMetadata and writeImage now expose the Apple Maker Note as makerApple, whose key '17' holds the Live Photo asset identifier.
Low-level image container I/O: read EXIF / GPS / TIFF / IPTC metadata, and encode images to formats (and with embedded metadata) that UIImage.toPNGData / toJPEGData can't produce.
Why not just use
UIImage? AUIImageis a decoded bitmap — by the time you have one, the original file's metadata (EXIF, GPS, ...) is already gone, andtoPNGData/toJPEGDatacannot write HEIC / TIFF / GIF.ImageIOworks at the encoded-container level, so it can both read existing metadata and write it back.
ImageIO.readMetadata(source)
Reads container-level metadata from a file path or Data. Rejects if the source can't be decoded as an image.
The well-known dictionaries (exif / gps / tiff / iptc) use Apple's CGImageProperties key names verbatim (gps.Latitude, exif.DateTimeOriginal, ...).
makerApple is the Apple Maker Note, whose keys are numeric strings. The one you're most likely to care about is '17', the Live Photo asset identifier that pairs a still image with its .mov:
You can write it too, but you rarely should — use LivePhoto.createFromVideo to build a valid Live Photo pair rather than stamping identifiers by hand. Only containers with an EXIF Maker Note (jpeg / heic) can carry it.
ImageIO.writeImage(options)
Encodes and writes an image to to. Provide exactly one of image or source:
Tag a photo with GPS while keeping its EXIF
Use the source variant — re-encoding through a UIImage would drop the original EXIF:
Caveats
imagedrops original metadata. AUIImageis a decoded bitmap. To preserve a file's existing EXIF/GPS, use thesourcevariant, notimage.qualityonly applies to jpeg / heic. It's ignored for png / tiff / gif.- HEIC encoding requires a device/simulator that supports the HEVC image encoder; on older simulators HEIC may fail — fall back to jpeg if
writeImagerejects. - Key names are raw CGImageProperties keys. When writing
exif/gps/tiff/iptc, use Apple's key names (e.g.Latitude,LatitudeRef,DateTimeOriginal).makerApplekeys are numeric strings ('17', ...). makerAppleneeds a Maker Note container. It only survives in jpeg / heic; writing it to png / tiff / gif silently does nothing.
